package com.job.client.message.controller;

import com.job.client.common.result.ResponseResult;
import com.job.client.message.service.NoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1/client/message/notice")
@Slf4j
@Api(tags = "客户端通知接口文档")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;
    @GetMapping("/all")
    @ApiOperation("获得全部的通知")
    public ResponseResult getAll(@RequestParam String userId ,@RequestParam Integer page,@RequestParam Integer size){
        return noticeService.getAll(userId,page,size);
    }
    @GetMapping("/unread")
    @ApiOperation("获得未读的通知")
    public ResponseResult unread(@RequestParam String userId,@RequestParam Integer page,@RequestParam Integer size){
        return noticeService.unread(userId,page,size);
    }
    @GetMapping("/read")
    @ApiOperation("获得已读的通知")
    public ResponseResult read(@RequestParam String userId,@RequestParam Integer page,@RequestParam Integer size){
        return noticeService.read(userId,page,size);
    }
    @PostMapping("/setRead")
    @ApiOperation("把未读消息设置为已读")
    public ResponseResult setRead(@RequestBody String noticeId){
        return noticeService.setRead(noticeId);
    }
    @PostMapping("/setRead/bluk")
    @ApiOperation(" 批量设置已读")
    public ResponseResult setReadBluk(@RequestBody List<String> noticeIdList){
        return noticeService.setReadBluk(noticeIdList);
    }
    @PostMapping("/delete/bluk")
    @ApiOperation(" 批量删除通知")
    public ResponseResult deleteBluk(@RequestBody List<String> noticeIdList){
        return noticeService.deleteBluk(noticeIdList);
    }
    @GetMapping("/count")
    @ApiOperation("获得未读数量")
    public ResponseResult getCount(@RequestParam String userId){
        return noticeService.getCount(userId);
    }
}
